package com.frogs.ucenter.dao.ibatis;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Repository;

import com.frogs.framework.base.dao.ibatis.BaseDaoIbatis;
import com.frogs.framework.util.PageList;
import com.frogs.ucenter.dao.UserAccountInfoDao;
import com.frogs.ucenter.entity.UserAccountInfo;
import com.frogs.ucenter.entity.UserBaseAccountInfo;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("userAccountInfoDao")
public class UserAccountInfoDaoImpl extends BaseDaoIbatis<UserAccountInfo> implements UserAccountInfoDao {

	public UserAccountInfoDaoImpl() {
		super();
		setNameSpace("user_account_info");
	}

	@SuppressWarnings("deprecation")
	@Required
	@Autowired
	public void setSqlMapClientAutowired(SqlMapClient sqlMapClient) {
		super.setSqlMapClient(sqlMapClient);
	}
	
	@SuppressWarnings("deprecation")
	@Override
    public UserBaseAccountInfo selectByUserId(Integer id) {
        return (UserBaseAccountInfo) this.getSqlMapClientTemplate().queryForObject(getNameSpace() + ".selectByUserId", id);
    }

	@SuppressWarnings("unchecked")
	@Override
	public PageList<UserBaseAccountInfo> listUserAccount(
			Map<String, Object> params, int pageNo, int pageSize) {
		return this.queryforPageList(getNameSpace() + ".selectBaseAccountByMap", params, pageNo, pageSize);
	}

}